﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;

namespace QLVT
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            HangHoa hanghoa = new HangHoa();
            DataTable dt = hanghoa.DanhSachHangHoa();
            cboHangHoa.ItemsSource = dt.DefaultView;
            cboHangHoa.DisplayMemberPath = "tenhang";
            cboHangHoa.SelectedValuePath = "mahang";

        }
        HoaDon hoadon = new HoaDon();
        private void LUU_Click(object sender, RoutedEventArgs e)
        {
            string sohd = txtshd.Text;
            string mahang = cboHangHoa.SelectedValue.ToString();
            string diengiai = txtdig.Text;
            double sl = double.Parse(txtsl.Text);
            double dg = double.Parse(txtdog.Text);
            hoadon.LuuHoaDon(sohd, mahang, diengiai, sl, dg);
            txtshd.Text = "";
            txtsl.Text = "";
            txtdog.Text = "";
            txtdig.Text = "";
            txtshd.Focus();

        }
       
        private void DONG_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

    }
}
